package cn.javacc.nav.web;

import java.util.List;

import javax.inject.Inject;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import cn.javacc.nav.domain.Link;
import cn.javacc.nav.service.LinkService;

@Controller
@RequestMapping("link")
public class LinkController extends cn.javacc.util.BaseController {
	@Inject
	private LinkService linkService;

	@RequestMapping(value = "/list", method = RequestMethod.GET)
	public String listLinks(@RequestParam(defaultValue = "0") Integer offset, @RequestParam(defaultValue = "24") Integer fetchSize, Model model) {
		List<Link> links = linkService.listLinks(offset, fetchSize);
		model.addAttribute("links", links);
		return "cms/admin/nav/linkList";
	}

}
